package ui;

import java.awt.Canvas;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver;

public class GraphViewIsingModelThread extends Canvas implements ImageObserver{
	
	private final int SLEEP_TIME = 50; // in miliseconds
	private final int GRAPH_DIMENSION = 200; // px
	private int spinNumber = 100;
	private int[][] spinValueArray;
	
	private Image image;
	BufferedImage img;
	private Graphics graphics;

	public GraphViewIsingModelThread()
	{
		image = this.createImage(GRAPH_DIMENSION, GRAPH_DIMENSION);
		//img = new BufferedImage(GRAPH_DIMENSION, GRAPH_DIMENSION, BufferedImage.TYPE_INT_ARGB);
		graphics = image.getGraphics();
		drawGrid();
	}
	
	public void updateSpinNumberInGrid(int spinsNumber)
	{
		
	}
	
	private void drawGrid()
	{
		graphics.setColor(Color.BLACK);
		int dxy = GRAPH_DIMENSION / spinNumber;
		for(int i = 0; i <= spinNumber; ++i)
		{
			graphics.drawLine(0,(int)(i*dxy),GRAPH_DIMENSION,(int)(i*dxy));
			graphics.drawLine((int)(i*dxy),0,(int)(i*dxy),GRAPH_DIMENSION);
		}
	}

}
